package day06_exception_collection.com.itheima.d6_set;

import java.util.Objects;

public class Student {
    private String name;
    private char sex;
    private String hobby;

    public Student() {
    }

    public Student(String name, char sex, String hobby) {
        this.name = name;
        this.sex = sex;
        this.hobby = hobby;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public char getSex() {
        return sex;
    }

    public void setSex(char sex) {
        this.sex = sex;
    }

    public String getHobby() {
        return hobby;
    }

    public void setHobby(String hobby) {
        this.hobby = hobby;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", sex=" + sex +
                ", hobby='" + hobby + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Student student = (Student) o;
        return getSex() == student.getSex() && Objects.equals(getName(), student.getName()) && Objects.equals(getHobby(), student.getHobby());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getName(), getSex(), getHobby());
    }
}
